# !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2021/11/1 11:09
# @Author  : zuodengbo
# @Email   : zuodb@amoydx.com
# @File    : models
# @Software: PyCharm
from tortoise.models import Model
from tortoise import fields

from utils.common import time_now


class PdBiokCategoryRule(Model):
    """
    Product biok category rule model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    category_rule_id = fields.IntField(description="分类规则标识")
    biok_id = fields.CharField(max_length=32, description="生物标志标识")
    biok_category_id = fields.CharField(max_length=32, description="生物标志分类标识")
    category_rule_detail = fields.CharField(max_length=128, description="分类规则详情")
    category_rule_ver = fields.CharField(max_length=32, description="biok_category_rule的版本")
    creator = fields.IntField(null=True, description="创建人")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    editor = fields.IntField(null=True, description="编辑人")
    edit_time = fields.DatetimeField(null=True, description="编辑时间")
    note = fields.TextField(null=True, description="备注")
    status = fields.IntField(default=1, description="状态")

    class Meta:
        table = "tbl_pd_biok_category_rule"


class PdBiokCutoff(Model):
    """
    Product biok cutoff model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    prod_id = fields.IntField(description="产品id")
    tumor_id = fields.IntField(null=True, description="肿瘤标识")
    biok_id = fields.IntField(description="生物标志标识")
    cutoff_lower = fields.IntField(description="cutoff的下限值")
    cutoff_upper = fields.IntField(null=True, description="cutoff的上限值")
    cutoff_ver = fields.CharField(max_length=32, null=True, description="cutoff的版本")
    category_rule_id = fields.IntField(description="category判定规则id")
    creator = fields.IntField(null=True, description="创建人")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    editor = fields.IntField(null=True, description="编辑人")
    edit_time = fields.DatetimeField(null=True, description="编辑时间")
    note = fields.TextField(null=True, description="备注")
    status = fields.IntField(default=1, description="状态")

    class Meta:
        table = "tbl_pd_biok_cutoff"


class PdComboUnit(Model):
    """
    Product combo unit model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    created_user = fields.CharField(max_length=32, null=True, description="创建人")
    prod_combo_id = fields.IntField(description="产品套餐标识")
    prod_unit_id = fields.IntField(description="产品单元标识")
    prod_unit_ver = fields.CharField(max_length=32, null=True, description="产品单元版本")
    note = fields.CharField(max_length=200, null=True, description="备注")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_combo_unit"


class PdDictProdTier(Model):
    """
    Product dict prod tier model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    prod_tier = fields.CharField(max_length=64, description="产品等级")
    prod_tier_value = fields.CharField(max_length=64, description="产品等级值")
    note = fields.TextField(null=True, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_dict_prod_tier"


class PdIhc(Model):
    """
    Product ihc model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    prod_code = fields.CharField(max_length=32, description="产品编码")
    platf_code = fields.CharField(max_length=32, description="平台编码")
    primary_ab_code = fields.CharField(max_length=32, description="ab原编码")
    primary_ab_name = fields.CharField(max_length=32, description="ab原名称")
    primary_ab_supplier = fields.CharField(max_length=32, description="")
    prod_trade_code = fields.CharField(max_length=32, description="产品商标编码")
    prod_trade_name = fields.CharField(max_length=32, description="产品商标名称")
    prod_alias = fields.CharField(max_length=32, null=True, description="产品别名")
    prod_ver = fields.CharField(max_length=32, null=True, description="产品版本")
    prod_note = fields.CharField(max_length=32, null=True, description="产品备注")
    launch_date = fields.DatetimeField(max_length=32, null=True, description="上线时间")
    unshelve_date = fields.DatetimeField(max_length=32, null=True, description="下架时间")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_ihc"


class PdPanel(Model):
    """
    Product panel model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    panel_id = fields.CharField(max_length=32, description="面板标识")
    panel_code = fields.CharField(max_length=32, null=True, description="面板编码")
    panel_name = fields.CharField(max_length=32, description="面板名称")
    panel_alias = fields.CharField(max_length=32, null=True, description="面板别名")
    panel_size = fields.CharField(max_length=32, null=True, description="面板尺寸")
    panel_ver = fields.CharField(max_length=32, description="面板版本")
    platf_code = fields.CharField(max_length=32, description="平台编码")
    panel_note = fields.CharField(max_length=65, null=True, description="面板备注")
    online_date = fields.DatetimeField(null=True, description="上线时间")
    offline_date = fields.DatetimeField(null=True, description="下线时间")
    remark = fields.CharField(max_length=255, null=True, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_panel"


class PdPanelProd(Model):
    """
    Product panel prod model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    panel_id = fields.CharField(max_length=256, description="面板标识")
    panel_ver = fields.CharField(max_length=256, description="面板版本")
    prod_id = fields.CharField(max_length=256, description="产品标识")
    prod_ver = fields.CharField(max_length=256, description="产品版本")
    status = fields.IntField(default=1, description="状态")
    validity = fields.IntField(default=1, description="有效性")
    online_date = fields.DatetimeField(null=True, description="上线时间")
    offline_date = fields.DatetimeField(null=True, description="下线时间")
    note = fields.CharField(max_length=256, null=True, description="备注")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.CharField(max_length=256, null=True, description="编辑人")
    created_user = fields.CharField(max_length=256, null=True, description="创建人")

    class Meta:
        table = "tbl_pd_panel_prod"


class PdPanelTube(Model):
    """
    Product panel tube model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    panel_id = fields.CharField(max_length=32, description="面板标识")
    panel_ver = fields.CharField(max_length=32, description="面板版本")
    tube_id = fields.CharField(max_length=32, description="管道标识")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_edotor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_panel_tube"


class PdProbe(Model):
    """
    Product probe model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    probe_id = fields.CharField(max_length=32, description="探针标识")
    probe_name = fields.CharField(max_length=32, description="探针名称")
    probe_seq = fields.CharField(max_length=32, description="探针序列")
    strand = fields.CharField(max_length=32, description="探针链")
    chr = fields.CharField(max_length=32, description="染色体")
    chr_start = fields.CharField(max_length=32, description="染色体开始位置")
    chr_end = fields.CharField(max_length=32, description="染色体结束位置")
    tech_type = fields.CharField(max_length=32, description="技术类型")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_probe"


class PdProd(Model):
    """
    Product prod model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    prod_id = fields.IntField(description="产品标识")
    platf_code = fields.CharField(max_length=32, description="平台编码")
    bims_package_id = fields.IntField(null=True, description="套餐标识")
    bims_package_name = fields.CharField(max_length=200, description="套餐名称")
    bims_inspection_item_id = fields.IntField(description="检查项目标识")
    bims_inspection_item_name = fields.CharField(max_length=200, description="检查项目名称")
    sub_prod_id = fields.IntField(null=True, description="子产品标识")
    prod_en = fields.CharField(max_length=200, null=True, description="产品-英文")

    class Meta:
        table = "tbl_pd_prod"


class PdProdCombo(Model):
    """
    Product prod combo model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    created_user = fields.CharField(max_length=32, null=True, description="")
    prod_id = fields.IntField(description="产品标识")
    prod_combo_id = fields.IntField(null=True, description="产品套餐标识")
    prod_tier = fields.IntField(null=True, description="产品层")
    prod_name = fields.CharField(max_length=200, null=True, description="产品名称")
    prod_alias = fields.CharField(max_length=200, null=True, description="产品别称")
    prod_trade_name = fields.CharField(max_length=200, null=True, description="商标名称")
    prod_series = fields.CharField(max_length=200, null=True, description="产品序列号")
    prod_ver = fields.CharField(max_length=200, null=True, description="产品版本")
    bims_package_id = fields.IntField(description="套餐标识")
    bims_package_code = fields.CharField(max_length=200, null=True, description="套餐编码")
    bims_package_name = fields.CharField(max_length=200, description="套餐名称")
    prod_ver_bims = fields.CharField(max_length=200, null=True, description="bims产品版本")
    launch_date = fields.CharField(max_length=200, null=True, description="上架时间")
    unshelve_date = fields.CharField(max_length=200, null=True, description="下架时间")
    note = fields.CharField(max_length=200, null=True, description="备注")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")
    bims_inspection_item_name = fields.CharField(max_length=200, null=True, description="检查项目名称")
    bims_inspection_item_id = fields.IntField(null=True, description="检查项目标识")
    platf_code = fields.CharField(max_length=32, null=True, description="平台编码")
    sub_prod_id = fields.IntField(null=True, description="子产品标识")
    
    class Meta:
        table = "tbl_pd_prod_combo"


class PdProdGene(Model):
    """
    Product prod gene model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    gene_id = fields.IntField(max_length=32, description="基因标识")
    prod_id = fields.CharField(max_length=256, description="产品标识")
    prod_ver = fields.CharField(max_length=256, description="产品版本")
    gene_symbol = fields.CharField(max_length=64, description="基因标志")
    rpt_var_type = fields.CharField(max_length=256, description="rpt变异类型")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    created_user = fields.IntField(null=True, description="创建人")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.IntField(null=True, description="编辑人")
    note = fields.TextField(null=True, description="备注")

    class Meta:
        table = "tbl_pd_prod_gene"


class PdProdI(Model):
    """
    Product prod i model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    prod_id = fields.CharField(max_length=32, description="产品标识")
    prod_code = fields.CharField(max_length=32, description="产品编码")
    prod_trade_code = fields.CharField(max_length=32, description="商标编码")
    prod_series = fields.CharField(max_length=32, description="产品序列号")
    panel_id = fields.CharField(max_length=32, description="面板标识")
    prod_trade_name = fields.CharField(max_length=32, description="商标名称")
    prod_alias = fields.CharField(max_length=32, description="产品别称")
    prod_ver = fields.CharField(max_length=32, description="产品版本")
    prod_note = fields.CharField(max_length=65, description="产品备注")
    launch_date = fields.CharField(max_length=32, description="上架时间")
    unshelve_date = fields.CharField(max_length=32, description="下架时间")
    remark = fields.CharField(max_length=32, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_prod_i"


class PdProdII(Model):
    """
    Product prod ii model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    prod_code = fields.CharField(max_length=32, description="产品编码")
    prod_trade_code = fields.CharField(max_length=32, description="商标编码")
    panel_code = fields.CharField(max_length=32, description="面板编码")
    prod_trade_name = fields.CharField(max_length=32, description="商标名称")
    prod_alias = fields.CharField(max_length=32, description="产品别称")
    prod_ver = fields.CharField(max_length=32, description="产品版本")
    prod_note = fields.CharField(max_length=65, description="产品备注")
    launch_date = fields.CharField(max_length=32, description="上架时间")
    unshelve_date = fields.CharField(max_length=32, description="下架时间")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_prod_ii"


class PdProdIII(Model):
    """
    Product prod iii model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    prod_code = fields.CharField(max_length=32, description="产品编码")
    prod_trade_code = fields.CharField(max_length=32, description="商标编码")
    prod_trade_name = fields.CharField(max_length=32, description="商标名称")
    prod_alias = fields.CharField(max_length=32, description="产品别称")
    prod_ver = fields.CharField(max_length=32, description="产品版本")
    prod_note = fields.CharField(max_length=64, description="产品备注")
    launch_date = fields.CharField(max_length=32, description="上架时间")
    unshelve_date = fields.CharField(max_length=32, description="下架时间")
    panel_code = fields.CharField(max_length=32, description="面板编码")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_prod_iii"


class PdProdIntrod(Model):
    """
    Product prod introd model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    prod_id = fields.IntField(description="产品标识")
    prod_ver = fields.CharField(max_length=256, description="产品版本")
    test_method = fields.CharField(max_length=256, description="检测方法")
    test_platf = fields.CharField(max_length=256, description="检测平台")
    test_content = fields.TextField(null=True, description="检测内容")
    test_significance = fields.TextField(null=True, description="检测意义")
    target_patient = fields.CharField(max_length=256, null=True, description="目标患者")
    created_user = fields.CharField(max_length=256, null=True, description="创建人")
    status = fields.IntField(default=1, description="状态")
    validity = fields.IntField(default=1, description="有效性")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.CharField(max_length=256, null=True, description="编辑人")
    note = fields.CharField(max_length=256, null=True, description="备注")

    class Meta:
        table = "tbl_pd_prod_introd"


class PdProdPanel(Model):
    """
    Product prod panel model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    prod_id = fields.IntField(description="产品标识")
    prod_ver = fields.CharField(max_length=64, description="产品版本")
    panel_id = fields.CharField(max_length=64, description="目标标识")
    panel_ver = fields.CharField(max_length=64, description="目标版本")
    note = fields.TextField(null=True, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_prod_panel"


class PdProdUnit(Model):
    """
    Product prod unit model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    created_user = fields.CharField(max_length=32, null=True, description="创建人")
    prod_id = fields.IntField(description="产品id")
    prod_unit_id = fields.IntField(description="产品单元标识")
    prod_name = fields.CharField(max_length=200, null=True, description="产品名称")
    prod_alias = fields.CharField(max_length=200, null=True, description="产品别名")
    prod_trade_name = fields.CharField(max_length=200, null=True, description="商标名称")
    prod_series = fields.CharField(max_length=200, null=True, description="产品序列号")
    prod_ver = fields.CharField(max_length=200, null=True, description="产品版本")
    platf_code = fields.CharField(max_length=32, description="平台编码")
    bims_inspection_item_id = fields.IntField(index=True, description="检查项目标识")
    bims_inspection_item_name = fields.CharField(max_length=200, description="检查项目名称")
    prod_ver_bims = fields.CharField(max_length=200, null=True, description="bims产品版本")
    launch_date = fields.CharField(max_length=65, null=True, description="上架时间")
    unshelve_date = fields.CharField(max_length=65, null=True, description="下架时间")
    note = fields.CharField(max_length=200, null=True, description="备注")
    last_time = fields.DatetimeField(null=True, description="更新时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_prod_unit"


class PdRegion(Model):
    """
    Product region model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    region_id = fields.CharField(max_length=32, description="区域标识")
    region_name = fields.CharField(max_length=32, description="区域名称")
    region_type = fields.CharField(max_length=32, description="区域类型")
    chr = fields.CharField(max_length=32, description="染色体")
    chr_start = fields.CharField(max_length=32, description="染色体开始位置")
    chr_end = fields.CharField(max_length=32, description="染色体结束位置")
    design_length = fields.CharField(max_length=32, description="设计长度")
    design_status = fields.IntField(default=1, description="设计状态")
    remark = fields.CharField(max_length=255, null=True, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_region"


class PdRegionProbe(Model):
    """
    Product region probe model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    created_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    region_id = fields.CharField(max_length=32, description="探针区域标识")
    probe_id = fields.CharField(max_length=32, description="探针标识")
    remark = fields.CharField(max_length=32, null=True, description="备注")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_editor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_region_probe"


class PdRegionSet(Model):
    """
    Product region set model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    panel_code = fields.CharField(max_length=32, description="目标编码")

    class Meta:
        table = "tbl_pd_region_set"


class PdSampleSeqDataset(Model):
    """
    Product sample seq dataset model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    specimen_id = fields.CharField(max_length=64, description="样品编号")
    type = fields.CharField(max_length=64, description="类型")
    dataset_code = fields.CharField(max_length=64, description="资料组编码")
    description = fields.CharField(max_length=32, null=True, description="描述")

    class Meta:
        table = "tbl_pd_sample_seq_dataset"


class PdTube(Model):
    """
    Product tube model
    """

    sq_no = fields.IntField(pk=True, description="序号")
    tube_id = fields.CharField(max_length=32, description="管道标识")
    probe = fields.CharField(max_length=32, description="探针")
    last_edited = fields.DatetimeField(null=True, description="编辑时间")
    last_edotor = fields.CharField(max_length=32, null=True, description="编辑人")

    class Meta:
        table = "tbl_pd_tube"


class SPcrRecord(Model):
    """
    S pcr record model
    """

    s_pcr_record_id = fields.IntField(pk=True, description="标识")
    sample_id = fields.CharField(max_length=128, description="样品编号")
    prod_id = fields.CharField(max_length=32, description="检测项目")
    engineer_id = fields.CharField(max_length=32, description="工程师")
    superior_id = fields.CharField(max_length=32, description="上级")
    test_time = fields.DatetimeField(description="检测日期")
    gender = fields.CharField(max_length=32, null=True, description="患者性别")
    age = fields.CharField(max_length=32, null=True, description="患者年龄")
    smoking_history = fields.CharField(max_length=32, null=True, description="吸烟史")
    item = fields.CharField(max_length=32, null=True, description="检测内容：基因，染色体缺失，MSI等")
    value = fields.CharField(max_length=32, description="检测结果")
    ct_mut = fields.FloatField(null=True, description="突变Ct值")
    ct_control_in = fields.FloatField(description="内控Ct值")
    hospital_code = fields.CharField(max_length=32, description="医院")
    department_code = fields.CharField(max_length=32, description="科室")
    inspection_department_code = fields.CharField(max_length=32, null=True, description="送检科室")
    type_code = fields.CharField(max_length=32, description="样本类型")
    tumor = fields.CharField(max_length=32, description="病理类型")
    create_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    create_user = fields.CharField(max_length=32, null=True, description="创建人")
    province = fields.CharField(max_length=32, description="省")

    class Meta:
        table = "tbl_s_pcr_record"


class SampleList(Model):
    """
    Sample list model
    """

    id = fields.IntField(pk=True, description="标识")
    location = fields.IntField(description="位置")
    is_clinic = fields.IntField(default=1, description="是否临床")
    clinic_id = fields.IntField(description="临床标识")
    c_sample_source_no = fields.CharField(max_length=50, description="样品源编号")
    sample_name = fields.CharField(max_length=50, description="样品名称")
    sample_type = fields.CharField(max_length=50, description="样品类型")
    sample_source = fields.CharField(max_length=50, description="样品源")
    sample_volumn = fields.FloatField(null=True, description="样品卷")
    sample_remain_volumn = fields.FloatField(null=True, description="样品残留卷")
    sample_concentration = fields.FloatField(null=True, description="试样浓缩")
    sample_preserve_location = fields.CharField(max_length=50, null=True, description="样品保存位置")
    extract_date = fields.DateField(description="提取日期")
    extract_person = fields.CharField(max_length=20, null=True, description="提取人")
    audit_person = fields.CharField(max_length=20, null=True, description="审核人")
    extract_reagent = fields.CharField(max_length=50, null=True, description="提取试剂")
    nanodrop = fields.CharField(max_length=50, null=True, description="纳米滴？nanodrop")
    quantus = fields.CharField(max_length=50, null=True, description="quantus")
    qc_2100_pe = fields.CharField(max_length=50, null=True, description="qc 2100 pe")
    note = fields.TextField(null=True, description="备注")
    exception_note = fields.CharField(max_length=50, null=True, description="异常备注")
    is_qualified = fields.IntField(default=1, description="是否有资格")
    record_person = fields.CharField(max_length=30, description="记录人")
    create_time = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    status = fields.IntField(default=0, description="状态")
    version = fields.IntField(description="版本")
    timestamp = fields.CharField(max_length=30, null=True, description="时间戳")

    class Meta:
        table = "sample_list"


class UserPi(Model):
    """
    User pi model
    """

    id = fields.IntField(pk=True, description="标识")
    create_date = fields.DatetimeField(auto_now_add=True, default=time_now(), description="创建时间")
    write_date = fields.DatetimeField(null=True, description="更新时间")
    create_uid = fields.IntField(null=True, description="创建人")
    write_uid = fields.IntField(null=True, description="更新人")
    pi_email = fields.CharField(max_length=128, description="极分析账号")
    pi_full_name = fields.CharField(max_length=128, description="PI姓名")
    pi_institution = fields.CharField(max_length=128, null=True, description="单位部门")
    pi_department = fields.CharField(max_length=128, null=True, description="科室")
    pi_gender = fields.CharField(max_length=32, null=True, description="性别")

    class Meta:
        table = "tbl_user_pi"


class VarRefer(Model):
    """
    Var refer model
    """

    var_refer_id = fields.IntField(pk=True, description="标识")
    var_id = fields.CharField(max_length=128, description="变异标识")
    interpretation = fields.TextField(description="解读")
    refer_id = fields.IntField(null=True, description="文献标识")
    pmid = fields.CharField(max_length=64, null=True, description="唯一标识码")

    class Meta:
        table = "tbl_var_refer"
